<?php
include('../../inc/global.inc');
include("../islogin.php");
$url="index_2.php";

if($_GET['del_act'])
{
$urls=$_SERVER['HTTP_REFERER'];
  $d_rs=@mysql_query("select id from product where member_id<1");
  //$d_row=@mysql_fetch_array($d_rs);
  while($d_row=@mysql_fetch_array($d_rs))
  {
		  if($d_row[catalog_id1]){
       $c_rs=@mysql_query("select * from catalog where id='$d_row[catalog_id1]'");
	   $c_row=@mysql_fetch_array($c_rs);
	   $p_num=$c_row[p_num]-1;
	   @mysql_query("update catalog set p_num='$p_num' where id='$c_row[id]'");
  }
  if($d_row[catalog_id2]){
       $c_rs=@mysql_query("select * from catalog where id='$d_row[catalog_id2]'");
	   $c_row=@mysql_fetch_array($c_rs);
	   $p_num=$c_row[p_num]-1;
	   @mysql_query("update catalog set p_num='$p_num' where id='$c_row[id]'");
  }  
 if($d_row[catalog_id3]){
       $c_rs=@mysql_query("select * from catalog where id='$d_row[catalog_id3]'");
	   $c_row=@mysql_fetch_array($c_rs);
	   $p_num=$c_row[p_num]-1;
	   @mysql_query("update catalog set p_num='$p_num' where id='$c_row[id]'");
  }
  //print_r($d_row);
@mysql_query("delete from product where id='".$d_row['id']."'");
@mysql_query("delete from hot_pro_list  where id='".$d_row['id']."'");

  }
  //exit;
  
echo "<script>location='".$urls."';</script>";

}
?>